<template>
	<view>
		<goods-choose-list :single="single" :priceType="1" :orderId="orderId" :details="details" :enterpriseid="enterpriseid" :userid="userid" :citypath="citypath" height="100vh" @confirm="handleConfirm"></goods-choose-list>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				orderId: 0,
				details: [],
				enterpriseid: 0,
				userid: 0,
				citypath: '',
				single: false
			}
		},
		computed: {
			...mapState('brother', {
				goodsDetails: state => state.goodsDetails,
			})
		},
		onLoad(options) {
			this.orderId = options.orderId;
			this.enterpriseid = options.enterpriseid;
			this.userid = options.userid;
			this.citypath = options.citypath;
			this.single = options.single == 'true' ? true:false;
			// console.log('options.single',options.single)
			// 从 Vuex 中读取 details
			this.details = this.goodsDetails;
		},
		methods: {
			setGoodsDetails(data) {
				this.$store.commit('brother/setGoodsDetails', data)
			},
			handleConfirm(confirmForm) {
				// 将 details 存储在 Vuex 中
				this.setGoodsDetails(confirmForm.details);
				uni.navigateBack()
			},
			handleCancel() {
				uni.navigateBack({
					delta: 1,
				});
			},
		}
	}
</script>

<style>

</style>